/**
 * Base Collection class.
 *
 *
 */
var	Collection	= function()
{
    this._data	= new Object();
}


/**
 * Static walk() method for Collection classes or any Iterable object
 *
 *
 *
 * @param collection	The Collection object to be walked through.
 * @param action		The action to be executed on each array element.
 * @param condition		The condition to process or not the action on a given element.
 * @param args			The arguments to be passed as a second parameter to the action and condition.
 */
function	walk(collection, action, condition, args)
{
    if (exists(array) && isFunction(action))
    {
        for (var key in collection)
        {
            var	element	= collection[key];

            if (isUndefined(condition) ||
                (isFunction(condition) && condition(element, args)))
            {
                action(element, args);
            }
        }
    }
}

/**
 * Static clear() method for Collection classes or any Iterable object
 *
 *
 *
 * @param collection	The Collection object to be walked through.
 */
function	clear(collection)
{
    if (exists(array))
    {
        for (var key in collection)
        {
            var	element	= collection[key];

            delete element;
            delete collection[key];
        }
    }
}

Collection.walk		= walk;
Collection.clear	= clear;
